//
//  ArtPlayView.m
//  test02
//
//  Created by lzh on 2021/3/11.
//  Copyright © 2021 NO. All rights reserved.
//

#import "ArtPlayView.h"
#import <Masonry.h>
@interface ArtPlayView()
@property(nonatomic,strong)UIView * palyerBack;
@property(nonatomic,strong)UILabel * title;
@property(nonatomic,strong)UILabel * des;
@property(nonatomic,strong)UILabel * money;// 免费或 要钱
@property(nonatomic,strong)UILabel * haveCount;//多少人获得
@property(nonatomic,strong)UIButton * wantLarnBtn;//想学
@property(nonatomic,strong)UIButton * shareBtn;//分享
@end

@implementation ArtPlayView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self makeUI];
    }
    return self;
}
-(void)makeUI{
    [self addSubview:self.palyerBack];
    [self addSubview:self.title];
    [self addSubview:self.des];
    [self addSubview:self.money];
    [self addSubview:self.haveCount];
    [self addSubview:self.wantLarnBtn];
    [self addSubview:self.shareBtn];
    [self.palyerBack mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(self);
        make.height.mas_offset(UIScreen.mainScreen.bounds.size.width/16*9);
    }];
    [self.title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.palyerBack.mas_bottom).offset(15);
        make.right.equalTo(self).offset(-15);
        make.left.equalTo(self).offset(15);
    }];
    [self.des mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.title.mas_bottom).offset(5);
        make.right.equalTo(self).offset(-15);
        make.left.equalTo(self).offset(15);
      }];
    [self.money mas_makeConstraints:^(MASConstraintMaker *make) {
      make.top.equalTo(self.des.mas_bottom).offset(10);
      make.left.equalTo(self).offset(15);
    }];
    [self.haveCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.money);
        make.left.equalTo(self.money.mas_right).offset(14);
    }];
    
    [self.shareBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-15);
        make.centerY.equalTo(self.money);
    }];
    
    [self.wantLarnBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.shareBtn.mas_left).offset(-30);
        make.centerY.equalTo(self.money);
    }];
    
}
-(void)setTopOffset:(CGFloat)topOffset{
    _topOffset = topOffset;
    [self.palyerBack mas_updateConstraints:^(MASConstraintMaker *make) {
        make.height.mas_offset(topOffset);
    }];
    
}
-(UIView *)palyerBack{
    
    if (!_palyerBack) {
        _palyerBack =[[UIView alloc]initWithFrame:CGRectZero];
        _palyerBack.backgroundColor = [UIColor blackColor];
    }
    return _palyerBack;
}
-(UILabel *)title{
    
    if (!_title) {
        _title = [[UILabel alloc]initWithFrame:CGRectZero];
        _title.text = @"水彩漫画风-动漫人物设计";
    }
    
    return _title;
}
-(UILabel *)des{
    
    if (!_des) {
        _des = [[UILabel alloc]initWithFrame:CGRectZero];
        _des.text = @"人物形体比例解析";
    }
    
    return _des;
}
-(UILabel *)money{
    
    if (!_money) {
        _money = [[UILabel alloc]initWithFrame:CGRectZero];
        _money.text = @"免费";
    }
    
    return _money;
}
-(UILabel *)haveCount{
    
    if (!_haveCount) {
        _haveCount = [[UILabel alloc]initWithFrame:CGRectZero];
    }
    
    return _haveCount;
}
-(UIButton *)shareBtn{
    
    if (!_shareBtn) {
        _shareBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_shareBtn setTitle:@"分享" forState:UIControlStateNormal];
        [_shareBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    }
    
    return _shareBtn;
}
-(UIButton *)wantLarnBtn{
    
    if (!_wantLarnBtn) {
        _wantLarnBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_wantLarnBtn setTitle:@"想学" forState:UIControlStateNormal];
        [_wantLarnBtn setImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
    }
    
    return _wantLarnBtn;
}

@end
